<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <title>cart</title>
</head>
<link rel="stylesheet" href="style.css">

<body>
    <div id="app">
        <div v-if="barbecue.length">
            <!--如果页面有数据存在，则显示，无则。。-->
            <table>
                <thead>
                    <tr>
                        <th></th>
                        <th>口味必选</th>
                        <th>免费配选畅饮/杯</th>
                        <th>价格</th>
                        <th>份数</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    <tr v-for="(item, index) in barbecue">
                        <td>{{item.id}}</td>
                        <td>
                            <img :src="item.image" alt="">
                            {{item.name}}
                        </td>
                        <td>
                            <select>
                                <option v-for="drink in softDrink">
                                    {{drink}}
                                </option>
                            </select>
                        </td>
                        <td>{{item.price | showPrice}}</td>
                        <td>
                            <button @click="decrement(index)" :disabled="item.count <= 1">-</button>
                            {{item.count}}
                            <button @click="increment(index)">+</button>
                        </td>
                        <td><button @click="removeHandle(index)">移除</button></td>
                    </tr>
                </tbody>
            </table>
            <h2>总价格：{{totalPrice | showPrice}}</h2>
        </div>
        <h2 v-else>购物车为空！</h2>
    </div>

    <script src="main.js"></script>
</body>

</html>